package multiplayer.lan;

import java.io.Serializable;

import utility.Color;
import utility.Point;
import world.player.Player;

public class Move  implements Serializable{
	String[] letter={"A","B","C","D","E","F","G","H"};
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Player player;
	private Point from;
	private Point to;
	
	public Move(Player player,Point from,Point to) {
		this.setPlayer(player);
		this.from=from;
		this.to=to;
	}
	public Move(Point from, Point to) {
		this.from=from;
		this.to=to;
	}
	public Point getFrom() {
		return from;
	}
	public Point getTo() {
		return to;
	}
	public Player getPlayer() {
		return player;
	}
	public void setPlayer(Player player) {
		this.player = player;
	}
	
	@Override
	public String toString() {
		String play=player.getColor().equals(Color.WHITE)?"Bianco":"Nero";
		StringBuilder sb = new StringBuilder();
		sb.append(play+ " da: ");
		sb.append(letter[from.getY()]+""+(8-from.getX()));
		sb.append(" a: ");
		sb.append(letter[to.getY()]+""+(8-to.getX()));
		return sb.toString();
	}
	
	
	
	

}
